package cate.game.activity.battleroyale.msg;

import cate.game.GameBody;
import cate.game.activity.battleroyale.po.RoleBattleRoyale;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBBattleRoyale;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "获取庙街食神记通关记录 の 请求")
public class BattleRoyaleRecordReq implements MsgInput {
    @NoteField(value = "功能ID")
    public int funcId;

    @NoteField(value = "章节")
    public int chapter;

    @NoteField(value = "关卡")
    public int level;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        RoleBattleRoyale single = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (single == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        EcResult<Void> r = single.getRecord(chapter, level);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBBattleRoyale.RECORD_REQ;
    }
}
